﻿// 1.1.4.07. Write a program that reads 5 integer numbers and prints their sum.
// If an invalid number is entered the program has to ask for another one.
using System;

class InputFiveValidNumbers
{
    static void Main()
    {
        string inputFirstNum = Console.ReadLine();
        double firstNum = 0;
        bool isValidFirstNum = double.TryParse(inputFirstNum, out firstNum);
        if (isValidFirstNum == false)
        {
            Console.WriteLine("Please enter valid number!");
            firstNum = double.Parse(Console.ReadLine());
        }
        string inputSecondNum = Console.ReadLine();
        double secondNum = 0;
        bool isValidSecondNum = double.TryParse(inputFirstNum, out firstNum);
        if (isValidSecondNum == false)
        {
            Console.WriteLine("Please enter valid number!");
            secondNum = double.Parse(Console.ReadLine());
        }
        string inputThirdNum = Console.ReadLine();
        double thirdNum = 0;
        bool isValidThirdNum = double.TryParse(inputFirstNum, out firstNum);
        if (isValidThirdNum == false)
        {
            Console.WriteLine("Please enter valid number!");
            thirdNum = double.Parse(Console.ReadLine());
        }
        string inputFourthNum = Console.ReadLine();
        double fourthNum = 0;
        bool isValidFourthNum = double.TryParse(inputFirstNum, out firstNum);
        if (isValidFourthNum == false)
        {
            Console.WriteLine("Please enter valid number!");
            fourthNum = double.Parse(Console.ReadLine());
        }
        string inputFifthNum = Console.ReadLine();
        double fifthNum = 0;
        bool isValidFifthNum = double.TryParse(inputFirstNum, out firstNum);
        if (isValidFifthNum == false)
        {
            Console.WriteLine("Please enter valid number!");
            fifthNum = double.Parse(Console.ReadLine());
        }
        Console.WriteLine("The sum of ur numbers is: {0}", firstNum + secondNum + thirdNum + fourthNum + fifthNum);
    }
}